package com.learn.controller;


import com.learn.config.AnotherComponent;
import com.learn.config.MyProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *
 * @author: hbliy
 * @date: 2025/11/6 11:41
 */
@RestController
@RequestMapping("/properties")
public class PropertiesController {

    private final MyProperties myProperties;

    public PropertiesController(MyProperties myProperties) {
        this.myProperties = myProperties;
    }

    @RequestMapping("/print")
    public String properties() {
        System.out.println(myProperties);
        return myProperties.toString();
    }


    @Autowired
    private AnotherComponent anotherComponent;

    @RequestMapping("/another")
    public String another() {
        System.out.println(anotherComponent);
        return anotherComponent.toString();
    }
}
